/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.workingtimemanager.urb.db;

import android.content.Context;
import de.workingtimemanager.urb.entities.Project;
import de.workingtimemanager.urb.entities.User;
import de.workingtimemanager.urb.entities.WorkDay;
import java.util.Vector;

/**
 *
 * @author CK05102
 */
public class DatabaseDump implements IDBHandler{

    private DatabaseDump instance;
    private Vector<User> users;
    private DatabaseHandler dbHandler;

    private DatabaseDump() {
        dbHandler = new DatabaseHandler();
    }

    public synchronized DatabaseDump getInstance() {
        if (instance == null) {
            instance = new DatabaseDump();
        }
        return instance;
    }
    
    public void insert(User user){
        
    }
    
    public void insert(Project project){
        
    }
    
    public void insert(WorkDay day){
        
    }
    
    public void copyUsers(Vector<User> users) {
        this.users = users;
    }
    
    public void open(Context context){        
    }
    
    public void close(){
    }

    public void insert(Object object) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    public void delete(Object object) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void deleteAll() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    public Vector<User> getAllUsers() {
         return users;
    }

    public User getUser(String name){
        if(users != null){
            for(User u : users){
                if(u.getUSERNAME().equals(name)){
                    return u;
                }
            }
        }
        return null;
    }

    public User getActiveUser(){
        if(users != null){
            for(User u : users){
                if(u.isActive()){
                    return u;
                }
            }
        }
        return null;        
    }
    
}
